(define-module (logic-predicates)
  #:export (any-pred? all-pred?))


(use-modules
 ;; for fold
 (srfi srfi-1))


(define any-pred?
  (λ (lst pred)
    (fold (λ (current-elem accumulated)
            (or (pred current-elem)
                accumulated))
          #f
          lst)))


(define all-pred?
  (λ (lst pred)
    (fold (λ (current-elem accumulated)
            (and (pred current-elem)
                 accumulated))
          #t
          lst)))
